{template "content","header"}
<link href="{CSS_PATH}hs/list_video.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{PLUGIN_STATICS_PATH}ckplayer/ckplayer.js" charset="utf-8"></script>
<div id="main">
    <div class="main setBoxHeight">
        <div id="dv_scroll">
            <div id="dv_scroll_text" class="Scroller-Container">
            {pc:content  action="lists" catid="$catid" order="id ASC" cache=86400 num="25"}
                {loop $data $l}
                    {if $n==1}
                    {pc:get sql="select * from v9_video_data where id=$l[id]" num="1" return="video"/}
                        {if $video[0]['videoPlayWho'] == 1}
                        <div id="playing"></div>
                        <script type="text/javascript">
                            var flashvars={
                                f:'{siteurl($siteid)}/video/{$video[0]["videoPath"]}',//flash版视频地址
                                c:'0',
                                p:1,//时候自动播放
                                wh:'16:9'//视频显示比例
                            };
                            var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:"transparent"};
                            var video=['{siteurl($siteid)}/video/{$video[0]["videoPath"]}->video/mp4'];
                            CKobject.embed('{PLUGIN_STATICS_PATH}ckplayer/ckplayer.swf','playing','ckplayer_a1','100%','540',true,flashvars,video,params)
                        </script>
                        {else}
                            <div id="playing">
                                <embed src="{$video[0]['youkuVideo']}" allowFullScreen="true" quality="high"width="100%" height="540px" align="middle" allowScriptAccess="always"
                                       type="application/x-shockwave-flash"></embed>
                            </div>
                        {/if}
                    {/pc}
                    {/if}
            {/loop}
            <div class="list">
                    <ul>
                        {loop $data $l}
                        {pc:get sql="select * from v9_video_data where id=$l[id]" num="1" return="video"/}
                        <li {if $n==1}class='cur'{/if} video="
                            {if $video[0]['videoPlayWho'] == 1}
                                {siteurl($siteid)}/video/{$video[0]["videoPath"]}
                            {else}
                                {$video[0]['youkuVideo']}
                            {/if}" videoType={$video[0]['videoPlayWho']}>
                                <img src="{$l['thumb']}" class="thumb" alt="{$l['title']}" title="{$l['title']}"/>
                                <img src="{IMG_PATH}hs/player.png" class="icon_player" alt=""/>
                            </li>
                        {/pc}
                        {/loop}
                    </ul>
                </div>
            {/pc}
            </div>
        </div>
    </div>
    <div id="dv_scroll_bar">
        <div class="Scrollbar-Up"></div>
        <div id="dv_scroll_track" class="Scrollbar-Track">
            <div class="Scrollbar-Handle"></div>
        </div>
        <div class="Scrollbar-Down"></div>
    </div><!--dv_scroll_bar end-->
</div>
<script>
    $(function(){
        $('#main .list li').click(function(){
            if($(this).hasClass('cur')) return false;
            var videoPath = $.trim($(this).attr('video'));
            var videoType = $(this).attr('videoType');
            $(this).addClass('cur').siblings('li').removeClass('cur');
            if(videoType == 1){
                flashvars={
                    f:videoPath,//flash版视频地址
                    c:'0',
                    p:1,//时候自动播放
                    wh:'16:9'//视频显示比例
                };
                params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:"transparent"};
                video=[videoPath+'->video/mp4'];
                CKobject.embed('{PLUGIN_STATICS_PATH}ckplayer/ckplayer.swf','playing','ckplayer_a1','100%','540',true,flashvars,video,params);
            }else{
                $('#playing').html('<embed src="'+videoPath+'" allowFullScreen="true" quality="high" width="100%" height="540px" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>');
            }
        })
        /**
         * 由于视频列表宽度不定，所以动态设置视频列表左边距，使其居中
         */
        function setVideoListLeft(){
            var m_left = $('#main .list ul').outerWidth()/2;
            var t_width = $('#main .list ul').outerWidth();
            var p_width = $('#main .list').width();
            if(t_width>=p_width){
                m_left = p_width/2;
            }
            $('#main .list ul').css({'margin-left':-m_left-5})
        }
        setVideoListLeft();
    })
</script>
<script src="{JS_PATH}hs/scrollbar.js"></script>
{template "content","footer"}